//
//  ViewController.m
//  Strong+CopyDemo
//
//  Created by isoftstone on 2018/9/19.
//  Copyright © 2018年 isoftstone. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property(nonatomic,strong) NSString *immutableStrongStr;
@property(nonatomic,copy) NSString *immutableCopyStr;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSMutableString *mutableStr = [NSMutableString stringWithString:@"BUSYLIFE"];
    self.immutableStrongStr = mutableStr;
    self.immutableCopyStr = mutableStr;
    NSLog(@"StrongStr:%@",_immutableStrongStr);
    NSLog(@"CopyStr:%@",_immutableCopyStr);
    
    [mutableStr appendString:@"1987"];

    NSLog(@"mutableStr:%@",mutableStr);
    NSLog(@"ChangedStrongStr:%@",_immutableStrongStr);
    NSLog(@"ChangedCopyStr:%@",_immutableCopyStr);
    
    NSLog(@"StrongStrAddress:%p",_immutableStrongStr);
    NSLog(@"CopyStrAddress:%p",_immutableCopyStr);
    NSLog(@"mutableStrAddress:%p",mutableStr);
}
@end
